package cz.proks.bank.service;

import java.math.BigDecimal;
import java.util.List;

import javax.jws.WebService;
import javax.xml.ws.WebServiceException;

import cz.cvut.felk.support.aos.sw.exchangerates.ExchangeRates;
import cz.cvut.felk.support.aos.sw.exchangerates.UnsupportedCurrencyFault;
import cz.cvut.felk.support.aos.sw.exchangerates.UnsupportedCurrencyFault_Exception;
import cz.proks.bank.client.ExchangeRatesServiceClient;

@WebService(endpointInterface = "cz.proks.bank.service.ExchangeRatesService", 
			serviceName = "ExchangeRatesService",
			portName = "ExchangeRatesServicePort",
			targetNamespace = "http://bank.proks.cz/service/ExchangeRatesService/")
public class ExchangeRatesServiceImpl implements ExchangeRatesService {	

	public BigDecimal getExchangeRate(String fromCurrency, String toCurrency) 
			throws UnsupportedCurrencyFault_Exception {
		return getClient().getExchangeRate(fromCurrency, toCurrency);	
	}

	public List<String> getSupportedCurrencies() {
		return getClient().getSupportedCurrencies();
	}
	
	private ExchangeRatesServiceClient getClient() throws WebServiceException {
		return new ExchangeRatesServiceClient();
	}
}
